// 柯里化
function checkAge(age) {
  let mini = 18;
  return age >= mini;
}

function checkAge1(mini, age) {
  return age >= mini;
}

// console.log(checkAge1(18, 20));
// console.log(checkAge1(18, 24));
// console.log(checkAge1(22, 24));

// 闭包 + 柯里化
function checkAge2(mini) {
  return function (age) {
    return age >= mini;
  };
}

// const check18 = checkAge2(18);
// const check22 = checkAge2(22);
// console.log(check18(20));
// console.log(check18(24));
// console.log(check18(24));

let checkAge3 = (mini) => (age) => age >= mini;
const check18 = checkAge3(18);
const check22 = checkAge3(22);
console.log(check18(20));
console.log(check18(24));
console.log(check18(24));
